﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using ORS.DAL;

namespace ORS.BLL
{
    public class Paper
    {
        #region 私有成员
        private int _paperId;	
        private string _title;	
        private string _authorId;
        private string _reviewer;
        private string _interestId;	
        private string _description;
        private string _contentLink;
        private string _submitDate;
        private string _submitlimitDate;
        private string _reviewState;
        #endregion 私有成员

        #region 属性

        public int PaperId
        {
            set
            {
                this._paperId = value;
            }
            get
            {
                return this._paperId;
            }
        }

        public string Title
        {
            set
            {
                this._title = value;
            }
            get
            {
                return this._title;
            }
        }
        public string AuthorId
        {
            set
            {
                this._authorId = value;
            }
            get
            {
                return this._authorId;
            }
        }
        public string Reviewer
        {
            set
            {
                this._reviewer = value;
            }
            get
            {
                return this._reviewer;
            }
        }
        public string InterestId
        {
            set
            {
                this._interestId = value;
            }
            get
            {
                return this._interestId;
            }
        }
        public string Description
        {
            set
            {
                this._description = value;
            }
            get
            {
                return this._description;
            }
        }
        public string ContentLink
        {
            set
            {
                this._contentLink = value;
            }
            get
            {
                return this._contentLink;
            }
        }
        public string SubmitDate
        {
            set
            {
                this._submitDate = value;
            }
            get
            {
                return this._submitDate;
            }
        }
        public string SubmitlimitDate
        {
            set
            {
                this._submitlimitDate = value;
            }
            get
            {
                return this._submitlimitDate;
            }
        }
        public string ReviewState
        {
            set
            {
                this._reviewState = value;
            }
            get
            {
                return this._reviewState;
            }
        }
        #endregion 属性


        #region 方法

        /// <summary>
        /// 向数据库添加一个paperInfo
        /// </summary>
        /// <param name="htUserInfo">用户信息哈希表</param>
        public static bool AddPaperInfo(String TableName, Hashtable userInfo)
        {
            Database db = new Database();
            int Count = 0;

            if (userInfo.Count <= 0)
            {
                return true;
            }

            String Fields = " (";
            String Values = " Values(";
            foreach (DictionaryEntry item in userInfo)
            {
                if (Count != 0)
                {
                    Fields += ",";
                    Values += ",";
                }
                Fields += "[" + item.Key.ToString() + "]";
                Values += item.Value.ToString();
                Count++;
            }
            Fields += ")";
            Values += ")";

            String SqlString = "Insert into " + TableName + Fields + Values;

            String[] Sqls = { SqlString };
            return db.ExecuteSQL(Sqls);
            //Database db = new Database();		//实例化一个Database类
            
        }

        /// <summary>
        /// 修改用户数据
        /// </summary>
        /// <param name="htUserInfo">用户信息哈希表</param>
        //public static void Update(Hashtable userInfo, string where)
        //{
        //    Database db = new Database();		//实例化一个Database类
        //    db.Update("[tb_paperinfo]", userInfo, where);	//利用Database类的Update方法修改用户数据
        //}

        //public bool Insert(String TableName, Hashtable Cols)
        //{
        //    Database db = new Database();
        //    int Count = 0;

        //    if (Cols.Count <= 0)
        //    {
        //        return true;
        //    }

        //    String Fields = " (";
        //    String Values = " Values(";
        //    foreach (DictionaryEntry item in Cols)
        //    {
        //        if (Count != 0)
        //        {
        //            Fields += ",";
        //            Values += ",";
        //        }
        //        Fields += "[" + item.Key.ToString() + "]";
        //        Values += item.Value.ToString();
        //        Count++;
        //    }
        //    Fields += ")";
        //    Values += ")";

        //    String SqlString = "Insert into " + TableName + Fields + Values;

        //    String[] Sqls = { SqlString };
        //    return db.ExecuteSQL(Sqls);
        //}




        #endregion 方法

        

    }
}